When a router device forwards a packet, if there are multiple equivalent outbound interfaces in a forwarding entry, the router device performs load sharing according to a packet feature, and evenly distributes traffic to all the outbound interfaces, to ensure that bandwidth resources of the router device are fully used. Load sharing is classified into two types: per-packet and per-flow. During per-packet load sharing, packets of a service flow are distributed onto different interfaces. The different interfaces have different physical parameters, which may cause out-of-order of the packets of the service flow, and therefore per-packet load sharing is less used in an existing network. During per-flow load sharing, the router device needs to perform hash (HASH) route selection according to a packet feature, and while load sharing is implemented, it is ensured that traffic with a same packet feature passes through a same outbound interface.
If router devices of multiple levels exist in a network, a router device on each level needs to perform hash route selection on traffic, and hash algorithms used by the router devices on all the levels are the same, a problem of uneven multi-level load sharing may exist, and when multi-level load sharing is uneven, a packet loss may be caused. As shown in FIG. 1, FIG. 1 is a schematic diagram of a network structure. When a device A performs hash route selection on traffic, the device A sends the traffic to a device B; the device B performs hash route selection on the traffic by using a same hash algorithm as that used by the device A, and a route selection result of the device B is the same as a route selection result of the device A, which causes a problem of uneven load sharing on the device B.
For the problem of uneven multi-level load sharing, generally, multiple hash algorithms are introduced, or in a hash route selection process, a disturbance factor is used to interfere with a hash route selection result, to reduce a coupling degree of load sharing results of different router devices. However, because a router device has a limited quantity of ports, even if disturbance factors of physical devices are different, a coupling degree of load sharing results obtained by router devices by performing hash operations according to disturbance factors may be also extremely high. In particular, when a network size is huge enough, there is always a case of uneven multi-level load sharing in router devices, which influences network operating quality.